package com.lhy.admin.gen;

import lombok.SneakyThrows;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

import java.util.Properties;

/**
 * ConfigUtil 获取配置文件
 *
 * @author hyluan
 * @date 2022年07月21日 17:12
 */
public class ConfigUtil {

    @SneakyThrows
    public static Properties getConfig() {
        EncodedResource encodedResource = new EncodedResource(new ClassPathResource("config.properties"), "UTF-8");
        //读取properties文件的值
        return PropertiesLoaderUtils.loadProperties(encodedResource);
    }
}
